<template>
  <!-- 触发自定义事件，没有listeners -->
  <p>{{ num }}</p>
  <button @click="$emit('update:num', num + 1)">add</button>
</template>

<script>
export default {
  name: "B",
  props: ["num"],
  emits: ["update:num"],
};
</script>

<style scoped>
</style>
